<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF8">
</head>
<body>
<div class="row">

	<div class="col-sm-9">
		<div id="alertContainer"></div>
		<h4>Centro de coste</h4>
		<form class="form-horizontal" role="form">
			<div class="form-group">
				<label class="col-sm-2 control-label input-sm">Nombre</label>
				<div class="col-sm-4">
					<input type='text' class="form-control input-sm" ng-model="entity.name" ng-readonly="isReadOnly" />
				</div>
				<label class="col-sm-2 control-label input-sm">NIF</label>
				<div class="col-sm-4">
					<input type='text' class="form-control input-sm" ng-model="entity.idCard.number" ng-readonly="isReadOnly" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label input-sm">Código</label>
				<div class="col-sm-4">
					<input type='text' class="form-control input-sm" ng-model="entity.code" ng-readonly="isReadOnly" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label input-sm">Email</label>
				<div class="col-sm-4">
					<input type="text" class="form-control input-sm" ng-model="entity.email" ng-readonly="isReadOnly" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label input-sm">Provincia</label>
				<div class="col-sm-4">
					<input type="text" class="form-control input-sm" ng-model="entity.address.province" typeahead="province as province.name for province in provinces($viewValue)" ng-readonly="isReadOnly" />
				</div>
				<label class="col-sm-2 control-label input-sm">Region</label>
				<div class="col-sm-4">
					<input type='text' class="form-control input-sm" ng-model="entity.address.region" typeahead="region as region.name for region in regions($viewValue)" ng-readonly="isReadOnly" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label input-sm">Dirección</label>
				<div class="col-sm-4">
					<input type="text" class="form-control input-sm" ng-model="entity.address.road" ng-readonly="isReadOnly" />
				</div>
				<label class="col-sm-2 control-label input-sm">Número</label>
				<div class="col-sm-4">
					<input type='text' class="form-control input-sm" ng-model="entity.address.floor" ng-readonly="isReadOnly" />
				</div>
			</div>
		</form>
	</div>
	<div class="col-sm-3">
		<div class="btn-toolbar" role="toolbar">
			<div class="btn-group">
				<button ng-click="edit()" ng-class='isReadOnly ? "btn btn-sm btn-primary" : "btn btn-sm btn-default"'>Editar</button>
				<button ng-click="load()" ng-class='isReadOnly ? "btn btn-sm btn-default" : "btn btn-sm btn-primary"'>
					<span class="glyphicon glyphicon-arrow-left"></span>
				</button>
				<button ng-click="update()" ng-class='isReadOnly ? "btn btn-sm btn-default" : "btn btn-sm btn-primary"'>
					<span class="glyphicon glyphicon-save"></span>
				</button>
				<button type="submit" ng-class='isReadOnly ? "btn btn-sm btn-default" : "btn btn-sm btn-primary"'>
					<span class="glyphicon glyphicon-trash"></span>
				</button>
			</div>
		</div>
		<div class="m-top-40">
			<h4>Entidades</h4>
			<ul class="list-unstyled">
				<li><a href="#/stores?owner={{entity.id}}">Consultar locales de este titular</a></li>
			</ul>
		</div>
		<div class="m-top-40">
			<h4>Facturación</h4>
			<ul class="list-unstyled">
				<li><a href="#">Facturas pendientes</a></li>
				<li><a href="#">Ver facturas emitidas</a></li>
			</ul>
		</div>
		<!-- popup con el json de debug -->
		<div class="m-top-40">
			<button class="btn btn-default btn-sm m-top-40" data-toggle="modal" data-target="#debugJson">Ver JSON</button>
			<div class="modal fade" id="debugJson" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<pre>entity = {{entity | json}}</pre>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</html>